<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    function send(){
        var folderName = document.getElementById("folderName").value;
        var fileName = document.getElementById("fileName").value;
        console.log(folderName);
        console.log(fileName);
        if(folderName==""||folderName==null){
            alert("故意不写文件夹地址是吧?");
        }else{
            if(fileName==""){
                var  a=folderName.split("\\");
                //批量
                var xhr = new XMLHttpRequest();
                xhr.open('post','http://localhost:8080/picAll');
                xhr.setRequestHeader('content-type','application/x-www-form-urlencoded');
                xhr.send("list=" + a);
                xhr.onreadystatechange = function(){
                    if(xhr.status==200&&xhr.readyState==4){
                        document.getElementById("text").value = xhr.responseText;
                        console.log(xhr.responseText);
                    }
                }
            }
            else{
                var  a=folderName.split("\\");
                //批量
                var xhr = new XMLHttpRequest();
                xhr.open('post','http://localhost:8080/picOne');
                xhr.setRequestHeader('content-type','application/x-www-form-urlencoded');
                xhr.send("list=" + a+"&fileName="+fileName);
                xhr.onreadystatechange = function(){
                    if(xhr.status==200&&xhr.readyState==4){
                        document.getElementById("text").value = xhr.responseText;
                        console.log(xhr.responseText);
                    }
                }
            }
        }
    }

    

</script>
<body>
    文件夹地址：<input type="text" id="folderName" /><br>
    文件名：<input type="text" id="fileName" /><br>
    <button onclick="send()">提交</button><br>
    ps:只填写文件夹地址，会打印文件夹中所有照片的信息，如需指定照片，需要填写文件夹地址和文件名 ，不可单独提交文件名
    <hr>
    <textarea id="text"></textarea>
</body>
</html>